﻿app.factory("categoriaService", function ($http) {
    var bUrl = "http://localhost:2142/api/";
    return {
        getListByFilter: function () {
            return $http.get(bUrl + "categoria").then(function (r) {
                return r;
            });
        },
        create: function (data) {
            return $http.post(bUrl + "categoria", data).then(function (r) {
                return r;
            });
        },
        "delete": function (id) {//por resource, vamo con el formato
            return $http.delete(bUrl + "categoria", { params: id }).then(function (r) {
                return r;
            });
        },
        update: function (idx, data) {
            return $http({
                method: "PUT",
                url: bUrl + "categoria/" + data.id,
                data: data
            }).then(function (r) {
                return r;
            });
        },
    }
});